using System;
using System.Configuration;
using System.IO;
using BookDownloader.Core.Data;

namespace BookDownloader.Core.Implementation.Flibusta
{
	[Serializable]
	public class ConfigPathProvider : IDestinationPathProvider
	{
		public string GenerateFilePath(RatedBook book, ILibFileFormat format)
		{
			string filename = String.Format("{0}({1}_{2}).{3}", book.Title.Replace(' ', '_').Replace(':', '-'), book.Rating, book.Votes, format.Extenstion);
			return Path.Combine(book.Author.Replace(' ', '_'), filename);
		}

		public DirectoryInfo GetDirectory()
		{
			return Utility.GetDirectoryFromConfig("DestinationPath");
		}
	}
}